home *** CD-ROM | disk | FTP | other *** search
- package java.lang.reflect;
-
- public class Modifier {
- public static final int PUBLIC = 1;
- public static final int PRIVATE = 2;
- public static final int PROTECTED = 4;
- public static final int STATIC = 8;
- public static final int FINAL = 16;
- public static final int SYNCHRONIZED = 32;
- public static final int VOLATILE = 64;
- public static final int TRANSIENT = 128;
- public static final int NATIVE = 256;
- public static final int INTERFACE = 512;
- public static final int ABSTRACT = 1024;
-
- public static boolean isAbstract(int mod) {
- return (mod & 1024) != 0;
- }
-
- public static boolean isFinal(int mod) {
- return (mod & 16) != 0;
- }
-
- public static boolean isInterface(int mod) {
- return (mod & 512) != 0;
- }
-
- public static boolean isNative(int mod) {
- return (mod & 256) != 0;
- }
-
- public static boolean isPrivate(int mod) {
- return (mod & 2) != 0;
- }
-
- public static boolean isProtected(int mod) {
- return (mod & 4) != 0;
- }
-
- public static boolean isPublic(int mod) {
- return (mod & 1) != 0;
- }
-
- public static boolean isStatic(int mod) {
- return (mod & 8) != 0;
- }
-
- public static boolean isSynchronized(int mod) {
- return (mod & 32) != 0;
- }
-
- public static boolean isTransient(int mod) {
- return (mod & 128) != 0;
- }
-
- public static boolean isVolatile(int mod) {
- return (mod & 64) != 0;
- }
-
- public static String toString(int mod) {
- StringBuffer sb = new StringBuffer();
- if ((mod & 1) != 0) {
- sb.append("public ");
- }
-
- if ((mod & 2) != 0) {
- sb.append("private ");
- }
-
- if ((mod & 4) != 0) {
- sb.append("protected ");
- }
-
- if ((mod & 1024) != 0) {
- sb.append("abstract ");
- }
-
- if ((mod & 8) != 0) {
- sb.append("static ");
- }
-
- if ((mod & 16) != 0) {
- sb.append("final ");
- }
-
- if ((mod & 128) != 0) {
- sb.append("transient ");
- }
-
- if ((mod & 64) != 0) {
- sb.append("volatile ");
- }
-
- if ((mod & 256) != 0) {
- sb.append("native ");
- }
-
- if ((mod & 32) != 0) {
- sb.append("synchronized ");
- }
-
- if ((mod & 512) != 0) {
- sb.append("interface ");
- }
-
- int len;
- return (len = sb.length()) > 0 ? sb.toString().substring(0, len - 1) : "";
- }
- }
-